<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>031-Promise的静态方法-rosolve.html</title>
</head>
<body>
	
</body>
<script type="text/javascript">
	//不带有任何参数，直接返回一个resolved状态的 Promise 对象
	const p1 = Promise.resolve()
	console.log(p1)
	//如果参数是Promise实例，那么Promise。resolve将不作任何修改、原封不动的返回这个实例
	const p2 = Promise.resolve(p1)
	console.log('p2',p2)
	console.log('p1==p2',p1==p2)
	//如果参数是一个具有then方法的对象，resolve方法会将这个对象转为 Promise对象然后就立即执行该对象的then方法
	const obj1 = {
		then:function(){
			console.log('then fn of obj1')
		}
	}

	const p3 = Promise.resolve(obj1)
	console.log('p3',p3)
	//如果参数,参数不是具有then方法的对象，或根本就不是对象，返回一个新的Promise对象，状态为resolved


	const obj2 = {
		noThen:function(){
			console.log('noThen fn of obj1')
		}
	}

	const p4 = Promise.resolve(obj2)
	console.log('p4',p4)


	const p5 = Promise.resolve('abc')
	console.log('p5',p5)


</script>
</html>